<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改热搜设置')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-recommendhistory-edit" th:object="${recommendHistory}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label">是否热搜：</label>
                <div class="col-sm-8">
                    <label class="toggle-switch switch-solid">
                     <input type="checkbox" id="hotSearch" th:checked="${recommendHistory.hotSearch == 0 ? false : true}">
                     <span></span>
                 </label>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script type="text/javascript">
        var prefix = ctx + "game/recommendhistory";
        $("#form-recommendhistory-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
            	var data = $("#form-recommendhistory-edit").serializeArray();
            	var hotSearch = $("input[id='hotSearch']").is(':checked') == true ? 1 : 0;
            	data.push({"name": "hotSearch", "value": hotSearch});
                $.operate.save(prefix + "/edit", data);
            }
        }

        $("input[name='hotSearchTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
    </script>
</body>
</html>